/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Gao zhao xu
 * Date: 2023-11-27
 * Time: 8:12
 */

import java.util.Scanner;
import java.util.Arrays;

public class Test1 {
    static char mapp[][] = new char[10][10];
    static int vis[] = new int[10];
    static int n, m, sum;

    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        while (cin.hasNext()) {
            n = cin.nextInt();
            m = cin.nextInt();
            Arrays.fill(vis, 0);
            if (m == -1 && n == -1)
                break;
            sum = 0;
            String s;
            for (int i = 1; i <= n; i++) {
                s = cin.next();
                for (int j = 1; j <= n; j++) {
                    mapp[i][j] = s.charAt(j - 1);
                }
            }
            dfs(1, 0);
            System.out.println(sum);
        }
    }

    private static void dfs(int ha, int yq) {
        if (ha >= n + 2)
            return;
        if (yq == m) {
            sum++;
            return;
        }
        for (int i = 1; i <= n; ++i) {
            if (mapp[ha][i] == '#' && vis[i] == 0) {
                vis[i] = 1;
                dfs(ha + 1, yq + 1);
                vis[i] = 0;
            }
        }
        dfs(ha + 1, yq);
    }
}
